Attribute VB_Name = "Module_AVerAPI_DVD"
Public Const ConError = 0
Public Const ConSVideo = 1
Public Const ConTuner = 2
Public Const ConComposite = 3
Public Const ConCamera = 4

Public Const VFormat_AutoDetect = 0
Public Const VFormat_NTSC = 1
Public Const VFormat_NTSC_J = 2
Public Const VFormat_PAL_BDGHI = 3
Public Const VFormat_PAL_M = 4
Public Const VFormat_PAL_N = 5
Public Const VFormat_SECAM = 6
Public Const VFormat_PAL_NC = 7

Public Const AQUALITY_CD = 0
Public Const AQUALITY_RADIO = 1
Public Const AQUALITY_TELEPHONE = 2
Public Const AQUALITY_NOAUDIO = 3

Public Const VideoSize_0 = 0   '160 X 120
Public Const VideoSize_1 = 1   '176 X 144
Public Const VideoSize_2 = 2   '240 X 176
Public Const VideoSize_3 = 3   '240 X 180
Public Const VideoSize_4 = 4   '320 X 240
Public Const VideoSize_5 = 5   '352 X 240
Public Const VideoSize_6 = 6   '352 X 288
Public Const VideoSize_7 = 7   '640 X 240
Public Const VideoSize_8 = 8   '640 X 288
Public Const VideoSize_9 = 9   '640 X 480
Public Const VideoSize_10 = 10 '704 X 576
Public Const VideoSize_11 = 11 '720 X 240
Public Const VideoSize_12 = 12 '720 X 288
Public Const VideoSize_13 = 13 '720 X 480
Public Const VideoSize_14 = 14 '720 X 576
Public Const VideoSize_15 = 15 '80  X 60
Public Const VideoSize_16 = 16 '88  X 72
Public Const VideoSize_17 = 17 '128 X 96
Public Const VideoSize_18 = 18 '640 X 576

Public Const DeInterlace_NONE = 0
Public Const DeInterlace_WEAVE = 1
Public Const DeInterlace_BOB = 2
Public Const DeInterlace_BOB_FIELD = 3

Public Const CF_RGB24 = 1
Public Const CF_RGB8 = 2

Public Const OVERLAY_TEXT = 0
Public Const OVERLAY_TIME = 1
Public Const OVERLAY_IMAGE = 2

Public Const FONTSIZE_SMALL = 0
Public Const FONTSIZE_BIG = 1

Public Const FORMAT_TIMEONLY = 0
Public Const FORMAT_DATEANDTIME = 1

Public Const IMAGETYPE_BMP = 0

Public Const ALIGNMENT_LEFT = 0
Public Const ALIGNMENT_CENTER = 1
Public Const ALIGNMENT_RIGHT = 2

Public Const GENERIC_WRITE = &H40000000
Public Const FILE_ATTRIBUTE_NORMAL = &H80
Public Const CREATE_ALWAYS = 2
Public Const OPEN_ALWAYS = 4
Public Const INVALID_HANDLE_VALUE = -1
Public Const FILE_BEGIN = 0
Public Const FILE_FLAG_DELETE_ON_CLOSE = &H4000000

Type BITMAPFILEHEADER
    bfType As Long
    bfSize As Long
    bfReserved1 As Integer
    bfReserved2 As Integer
    bfOffBits As Long
End Type

Public Type BITMAPINFOHEADER
  biSize As Long
  biWidth As Long
  biHeight As Long
  biPlanes As Integer
  biBitCount As Integer
  biCompression As Long
  biSizeImage  As Long
  biXPelsPerMeter As Long
  biYPelsPerMeter As Long
  biClrUsed As Long
  biClrImportant As Long
End Type

Public Type SYSTEMTIME
    wYear   As Integer
    wMonth   As Integer
    wDayOfWeek   As Integer
    wDay   As Integer
    wHour   As Integer
    wMinute   As Integer
    wSecond   As Integer
    wMilliseconds   As Integer
End Type


Public Type RECT
    Left    As Long
    Top     As Long
    Right   As Long
    Bottom  As Long
End Type

Public Type OVERLAY_POSITION
    dwXPos As Long
    dwYPos As Long
    dwAlignment As Long
End Type

Public Type OVERLAY_INFO
    bEnableOverlay As Long
    dwFontSize As Long
    dwFontColor As Long
    dwTransparency As Long
    WindowPosition As OVERLAY_POSITION
End Type

Public Const CT_SEQUENCE_FIELD = 0
Public Const CT_SEQUENCE_FRAME = 1

Public Const ST_BMP = 0
Public Const ST_JPG = 1
Public Const ST_AVI = 2
Public Const ST_CALLBACK = 3

Public Const DURATION_TIME = 1
Public Const DURATION_COUNT = 2

Public Type VIDEO_SAMPLE_INFO
    dwWidth As Long
    dwHeight As Long
    dwStride As Long
    dwPixelFormat As Long
End Type

Public Type VIDEO_CAPTURE_INFO
    dwCaptureType As Long
    dwSaveType As Long
    bOverlayMix As Long
    dwDurationMode As Long
    dwDuration As Long
    lpFileName As Long
    lpCallback As Long
    lCallbackUserData As Long
End Type

    
Declare Function AVER_Init Lib "AVerAPI" (ByVal hwnd As Long, ByVal VSize As Long) As Long
Declare Function AVER_Close Lib "AVerAPI" () As Long

Declare Function AVER_PaintOverlay Lib "AVerAPI" (RECT As RECT) As Long
Declare Function AVER_StopOverlay Lib "AVerAPI" (RECT As RECT) As Long
Declare Function AVER_PaintPreview Lib "AVerAPI" (ByVal hdc As Long) As Long

Declare Function AVER_GetVideoSource Lib "AVerAPI" () As Long
Declare Function AVER_SetVideoSource Lib "AVerAPI" (ByVal VideoSource As Long) As Long

Declare Function AVER_GetVideoFormat Lib "AVerAPI" () As Long
Declare Function AVER_SetVideoFormat Lib "AVerAPI" (ByVal VideoFormat As Long) As Long

Declare Function AVER_GetColorFormat Lib "AVerAPI" () As Long
Declare Function AVER_SetColorFormat Lib "AVerAPI" (ByVal ColorFormat As Long) As Long

Declare Function AVER_GetBrightness Lib "AVerAPI" () As Long
Declare Function AVER_SetBrightness Lib "AVerAPI" (ByVal Brightness As Long) As Long

Declare Function AVER_GetContrast Lib "AVerAPI" () As Long
Declare Function AVER_SetContrast Lib "AVerAPI" (ByVal Contrast As Long) As Long

Declare Function AVER_GetSaturation Lib "AVerAPI" () As Long
Declare Function AVER_SetSaturation Lib "AVerAPI" (ByVal Saturation As Long) As Long

Declare Function AVER_GetHue Lib "AVerAPI" () As Long
Declare Function AVER_SetHue Lib "AVerAPI" (ByVal Hue As Long) As Long

Declare Function AVER_CaptureSequence Lib "AVerAPI" (ByVal FileName As String) As Long
Declare Function AVER_CaptureSingleImage Lib "AVerAPI" (ByVal lpData As Long, ByVal nWidth As Long, ByVal nHeight As Long) As Long

Declare Function AVER_CaptureVideo Lib "AVerAPI" (ByVal lpvFileName As String, ByVal AudFmt As Long) As Long
Declare Function AVER_CaptureStop Lib "AVerAPI" () As Long

Declare Function AVER_MoveVideoWindow Lib "AVerAPI" (ByVal nLeft As Integer, ByVal nTop As Long) As Boolean

Declare Function AVER_GetDeInterlace Lib "AVerAPI" () As Long
Declare Function AVER_SetDeInterlace Lib "AVerAPI" (ByVal nDeI As Long) As Long

Declare Function AVER_SaveBMPFile Lib "AVerAPI" () As Long
Declare Function AVER_SaveJPGFile Lib "AVerAPI" () As Long
Declare Function AVER_CaptureSequenceToJPG Lib "AVerAPI" (ByVal str As String) As Long

Declare Function AVER_GetVideoCaptureDeviceName Lib "AVerAPI" (ByVal szDeviceName1 As String, ByVal szDeviceName2 As String, ByVal szDeviceName3 As String, ByVal szDeviceName4 As String) As Long

Declare Function AVER_SetVideoCaptureDeviceName Lib "AVerAPI" (ByVal szDeviceName As String, ByVal nDriver As Long) As Long
Declare Function AVER_GetDeviceType Lib "AVerAPI" (ByRef pdwDeviceType As Long) As Long
       
Declare Function AVER_SetOverlayProperty Lib "AVerAPI" (ByVal dwContentType As Long, ByVal bEnableOverlay As Long, ByVal dwFontSize As Long, ByVal dwFontColor As Long, ByVal dwTransparency As Long, ByVal dwXPos As Long, ByVal dwYPos As Long, ByVal dwAlignment As Long) As Long
Declare Function AVER_GetOverlayProperty Lib "AVerAPI" (ByVal dwContentype As Long, ByRef pOverlayInfo As OVERLAY_INFO) As Long
Declare Function AVER_OverlayText Lib "AVerAPI" (ByVal lpText As Long, ByVal dwDuration As Long) As Long
Declare Function AVER_OverlayTime Lib "AVerAPI" (ByVal dwFormat As Long, ByVal dwDuration As Long) As Long

Declare Function AVER_CaptureVideoSequenceStart Lib "AVerAPI" (ByVal dwCaptureType As Long, ByVal dwSaveType As Long, ByVal bOverlayMix As Long, ByVal dwDurationMode As Long, ByVal dwDuration As Long, ByVal lpFileName As Long, ByVal lpCallback As Long, ByVal lCallbackUserData As Long) As Long
Declare Function AVER_CaptureVideoSequenceStop Lib "AVerAPI" () As Long

Declare Function AVER_GetPicFile Lib "AVerAPI" (ByRef BmpInfo As BITMAPINFOHEADER) As Long

Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Declare Function GetProcessHeap Lib "kernel32" () As Long
Declare Function HeapAlloc Lib "kernel32" (ByVal hHeap As Long, ByVal dwFlags As Long, ByVal dwBytes As Long) As Long
Declare Function HeapFree Lib "kernel32" (ByVal hHeap As Long, ByVal dwFlags As Long, ByVal lpMem As Long) As Long
Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (ByVal Destination As Long, ByVal Source As Long, ByVal Length As Long)
Declare Function CreateFile Lib "kernel32" Alias "CreateFileW" (ByVal lpFileName As Long, ByVal dwDesiredAccess As Long, ByVal dwShareMode As Long, ByVal lpSecurityAttributes As Long, ByVal dwCreationDisposition As Long, ByVal dwFlagsAndAttributes As Long, ByVal hTemplateFile As Long) As Long
Declare Function WriteFile Lib "kernel32" (ByVal hFile As Long, ByVal lpBuffer As Long, ByVal nNumberOfBytesToWrite As Long, ByRef lpNumberOfBytesWritten As Long, ByVal lpOverlapped As Long) As Long
Declare Function CloseHandle Lib "kernel32" (ByVal hHandle As Long) As Long
Declare Function SetFilePointer Lib "kernel32" (ByVal hFile As Long, ByVal lDistanceToMove As Long, ByVal lpDistanceToMoveHigh As Long, ByVal dwMoveMethod As Long) As Long
Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Declare Function StretchDIBits Lib "gdi32" (ByVal hdc As Long, ByVal XDest As Long, ByVal YDest As Long, ByVal nDestWidth As Long, ByVal nDestHeight As Long, ByVal XSrc As Long, ByVal YSrc As Long, ByVal nSrcWidth As Long, ByVal nSrcHeight As Long, ByVal lpBits As Long, ByVal lpBitsInfo As Long, ByVal iUsage As Long, ByVal dwRop As Long) As Long
Declare Function GetPrivateProfileString Lib "kernel32" Alias "GetPrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As String, ByVal lpDefault As String, ByVal lpRetunedString As String, ByVal nSize As Long, ByVal lpFileName As String) As Long
Declare Sub GetSystemTime Lib "kernel32 " (lpSystemTime As SYSTEMTIME)
Declare Function InvalidateRect& Lib "user32" (ByVal hwnd As Long, lpRect As RECT, ByVal bErase As Long)

Declare Sub ZeroMemory Lib "kernel32" Alias "RtlZeroMemory" (Destination As Any, ByVal Length As Long)

Declare Function SHGetSpecialFolderPathW Lib "Shell32" (ByVal hwndOwner As Long, ByVal lpszPath As String, ByVal nFolder As Long, ByVal fCreate As Long) As Long

            
Public Sub GetClientRect(rectClient As RECT)

    rectClient.Left = MainFrame.VideoWnd.Left
    rectClient.Right = MainFrame.VideoWnd.Width / 15
    rectClient.Top = MainFrame.VideoWnd.Top
    rectClient.Bottom = MainFrame.VideoWnd.Height / 15
    
End Sub

